﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 松耦合
{
    internal class Program
    {
        static void Main(string[] args)
        {
            PhoneUser pu = new PhoneUser(new Nokia());
            pu = new PhoneUser(new Moto());
            pu.UsePhone();
            Console.ReadKey();
        }
    }
    /// <summary>
    /// 手机用户
    /// </summary>
    class PhoneUser
    {
        public IPhone phone;

        public PhoneUser(IPhone phone)
        {
            this.phone = phone;
        }

        public void UsePhone()
        {
            phone.Call();
            phone.Sms();
            phone.Video();
            phone.Music();
        }
    }

    /// <summary>
    /// 手机接口,接口的特点：
    /// 1，接口不能实现方法
    /// 2，接口不能有属性
    /// 3，接口不能有构造方法
    /// 4，接口不能有静态方法
    /// 5，接口不能有实例方法
    ///
    /// </summary>
    interface IPhone
    {
        void Call();
        void Sms();
        void Radio();
        void Music();
        void Video();
    }

    /// <summary>
    /// <summary>
    /// Nokia手机
    /// </summary>
    /// </summary>
    class Nokia : IPhone
    {
        public void Call()
        {
            Console.WriteLine("Nokia Call...");
        }

        public void Music()
        {
            Console.WriteLine("Nokia Music...");
        }

        public void Radio()
        {
            Console.WriteLine("Nokia Radio...");
        }

        public void Sms()
        {
            Console.WriteLine("Nokia Sms...");
        }

        public void Video()
        {
            Console.WriteLine("Nokia Video...");
        }
    }

    /// <summary>
    /// Moto手机
    /// </summary>
    class Moto : IPhone
    {
        public void Call()
        {
            Console.WriteLine("Moto Video...");
        }

        public void Music()
        {
            Console.WriteLine("Moto Music...");
        }

        public void Radio()
        {
            Console.WriteLine("Moto Radio...");
        }

        public void Sms()
        {
            Console.WriteLine("Moto Sms...");
        }

        public void Video()
        {
            Console.WriteLine("Moto Video...");
        }
    }
}
